package com.design.responsibility.demo1;

// 银行转账支付处理器
class BankTransferProcessor implements PaymentProcessor {
    private PaymentProcessor nextProcessor;

    @Override
    public void setNextProcessor(PaymentProcessor nextProcessor) {
        this.nextProcessor = nextProcessor;
    }

    @Override
    public void processPayment(float amount) {
        if (amount > 1000) {
            System.out.println("Processed payment of $" + amount + " using Bank Transfer.");
        } else if (nextProcessor != null) {
            nextProcessor.processPayment(amount);
        }
    }
}
